#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include<QGraphicsScene>
#include<QLabel>
#include<QResizeEvent>
#include<QGraphicsItem>
#include<QFileDialog>
#include<QGraphicsView>
#include<QMouseEvent>
#include<QDebug>
#include<QMessageBox>


QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE






class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
private:
    QGraphicsScene *scene=nullptr;
    QLabel *labViewCord;
    QLabel *labSceneCord;
    QLabel *labItemCord;
    QLabel *pixelValueAtCord;
    QPoint startPoint;

    QPointF pointItem;
    unsigned int longX, longY;
    bool isLeftButtonPressed=false;
    QImage *image=nullptr;
    void iniGraphicsSystem();    // 创建Graphics View的各项
protected:
    void keyPressEvent(QKeyEvent *event) override;
    void resizeEvent(QResizeEvent *event) override;

private slots:
    void on_mouseMovePoint(QPoint point, QPoint endP,QPoint startP);
    void on_ROIButton_clicked(bool checked);
    void on_readImage_clicked();
    void on_zoomImage_clicked();

private:
    QGraphicsRectItem *itemRect=nullptr;
    QGraphicsPixmapItem *pixmapItem=nullptr;
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
